<template>
    <el-card shadow="never" style="border: 0;">
        <yun-form
                :data="row"
                ref="yunForm"
                :columns="columns">
                <template #default>
                    {:token_field()}
                </template>
            <template #licence="{rows}" >
                <el-form-item label="行驶证:">
                    <img :src="rows.licence" style="height: 250px;cursor: pointer;" @click="showPic(rows.licence)"/>
                </el-form-item>
            </template>
            <template #footer>
                <el-button type="success" @click="approved"><i class="fa fa-check"></i>&nbsp;审核通过</el-button>
                <el-button type="danger" @click="refuse"><i class="fa fa-remove"></i>&nbsp;拒绝通过</el-button>
            </template>
        </yun-form>
    </el-card>
</template>
<script>
    import form from "@components/Form.js";
    import fieldlist from "@components/Fieldlist.js";
    export default{
        components:{
            'YunForm':form
        },
        data:{
            columns:[
                {field:"plate_number",title:"认证车牌号",edit:"readonly"},
                {field:"user.nickname",title:"认证微信",edit:"readonly"},
                {field:"licence",title:"行驶证",edit:"slot"},
            ],
            row:Yunqi.data.row
        },
        methods: {
            showPic:function (url){
                Yunqi.api.previewImg(url);
            },
            refuse:function (){
                Yunqi.ajax.post('plate/auth',{ids:this.row.id,auth:0}).then(res=>{
                    Yunqi.api.closelayer(Yunqi.app.window.id,true);
                });
            },
            approved:function (){
                Yunqi.ajax.post('plate/auth',{ids:this.row.id,auth:1}).then(res=>{
                    Yunqi.api.closelayer(Yunqi.app.window.id,true);
                });
            }
        }
    }
</script>
<style>
</style>